package logic

import (
	"context"
	"doc-manage/models/mysql"

	"doc-manage/docrpc/docrpc"
	"doc-manage/docrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type DocShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDocShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocShowLogic {
	return &DocShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 医生详情
func (l *DocShowLogic) DocShow(in *docrpc.DocShowRequest) (*docrpc.DocShowResponse, error) {
	// todo: add your logic here and delete this line

	var doctor mysql.Doctor

	err := doctor.DoctorShow(mysql.DB, in.DoctorId)
	if err != nil {
		return nil, err
	}

	return &docrpc.DocShowResponse{
		DoctorId: int64(doctor.ID),
		Name:     doctor.Name,
		Asc:      doctor.Asc,
		Desc:     doctor.Desc,
	}, nil
}
